home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / tests / pdevtest / RCS / server.c,v < prev   
Encoding:
Text File  |  1989-01-31  |  18.6 KB  |  744 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    brent:1.3; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     88.08.26.17.43.37;  author brent;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     88.08.26.16.23.53;  author brent;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.04.16.12.28.31;  author brent;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @Server code for pseudo-device benchmark
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Updated to new, standard, pseudo-device interface
  33. @
  34. text
  35. @/* 
  36.  * server.c --
  37.  *
  38.  *    The server part of some multi-program synchronization primatives.
  39.  *    The routines here control N client programs.  This just means
  40.  *    telling them all to start, and hearing back from them when they're done.
  41.  *
  42.  * Copyright 1986 Regents of the University of California
  43.  * All rights reserved.
  44.  */
  45.  
  46. #ifndef lint
  47. static char rcsid[] = "$Header: server.c,v 1.2 88/08/26 16:23:53 brent Exp $ SPRITE (Berkeley)";
  48. #endif not lint
  49.  
  50.  
  51. #include "sprite.h"
  52. #include "status.h"
  53. #include "fs.h"
  54. #include "dev/pdev.h"
  55. #include "io.h"
  56. #include "bit.h"
  57. #include "time.h"
  58. #include "sys.h"
  59.  
  60. char *pdev="./pdev.new";
  61.  
  62. extern Boolean writeBehind;
  63. extern int delay;
  64.  
  65. typedef int  (*IntProc)();
  66.  
  67. typedef struct ServerState {
  68.     int cntlStream;    /* Control stream to find out new clientStream's */
  69.     int numClients;
  70.     int *clientStream;    /* Array of client streams */
  71.     int maxStreamID;
  72.     Address *request;    /* Array of client request buffers */
  73.     char *clientState;    /* Array of client state words */
  74.     int *selectMask;
  75.     int selectMaskBytes;
  76.     IntProc opTable[7];    /* Operation switch table */
  77. } ServerState;
  78.  
  79. #define REQUEST_BUF_SIZE    (2048 + sizeof(Pdev_Request))
  80. #define CLIENT_OPENED    0x1
  81. #define CLIENT_STARTED    0x2
  82. #define CLIENT_FINISHED    0x4
  83.  
  84. /*
  85.  * Need the select flag to know if we should block the client.
  86.  */
  87. extern Boolean select;
  88. Boolean blocked = FALSE;
  89.  
  90. /*
  91.  * Forward Declarations
  92.  */
  93. ReturnStatus NullProc();
  94. ReturnStatus ServeOpen();
  95. ReturnStatus ServeRead();
  96. ReturnStatus ServeWrite();
  97. ReturnStatus ServeIOControl();
  98. Pdev_Op ServeRequest();
  99.  
  100.  
  101. /*
  102.  *----------------------------------------------------------------------
  103.  *
  104.  * ServerSetup --
  105.  *
  106.  *    Establish contact with N clients.  A pseudo device is opened
  107.  *    and we are declared its "master", or "server".  After this
  108.  *    other processes can open the pseudo device and we'll get a private
  109.  *    stream back that we use for requests from that process.
  110.  *
  111.  * Results:
  112.  *    A pointer to state about the clients needed by ServerStart and
  113.  *    ServerWait.
  114.  *
  115.  * Side effects:
  116.  *    Opens the pseudo device as the server and waits for numClients
  117.  *    opens by client processes.
  118.  *    This exits (kills the process) upon error.
  119.  *
  120.  *----------------------------------------------------------------------
  121.  */
  122.  
  123. void
  124. ServerSetup(numClients, dataPtr)
  125.     int numClients;
  126.     ClientData *dataPtr;
  127. {
  128.     ServerState *statePtr;
  129.     int client;
  130.     int len;
  131.     int amountRead;
  132.     ReturnStatus status;
  133.     Pdev_Notify notify;
  134.     Pdev_SetBufArgs setBuf;
  135.     int streamID;
  136.     int maxStreamID;
  137.  
  138.     statePtr = (ServerState *)Mem_Alloc(sizeof(ServerState));
  139.     statePtr->clientStream = (int *)Mem_Alloc(numClients * sizeof(int));
  140.     statePtr->clientState = (char *)Mem_Alloc(numClients);
  141.     statePtr->request = (Address *)Mem_Alloc(numClients * sizeof(Address));
  142.     statePtr->numClients = numClients;
  143.  
  144.     statePtr->opTable[(int)PDEV_OPEN] = ServeOpen;
  145.     statePtr->opTable[(int)PDEV_CLOSE] = NullProc;
  146.     statePtr->opTable[(int)PDEV_READ] = ServeRead;
  147.     statePtr->opTable[(int)PDEV_WRITE] = ServeWrite;
  148.     statePtr->opTable[(int)PDEV_IOCTL] = ServeIOControl;
  149.  
  150.     /*
  151.      * Open the pseudo device.
  152.      */
  153.     status = Fs_Open(pdev, FS_READ|FS_CREATE|FS_NEW_MASTER,
  154.              0666, &statePtr->cntlStream);
  155. #ifdef notdef
  156.     if (status == FS_FILE_NOT_FOUND) {
  157.     status = Fs_Open(pdev, FS_CREATE|FS_READ|FS_NEW_MASTER,
  158.              0666, &statePtr->cntlStream);
  159.     }
  160. #endif 
  161.     if (status != SUCCESS) {
  162.     Stat_PrintMsg(status, "Error opening pseudo device as master");
  163.     Proc_Exit(status);
  164.     }
  165.     maxStreamID = 0;
  166.     for (client=0 ; client<numClients ; client++) {
  167.     /*
  168.      * Read on our control stream (the one we just opened) messages
  169.      * that contain new streamIDs.  These are for private streams
  170.      * back to the client process..
  171.      */
  172.     len = sizeof(notify);
  173.     status = Fs_Read(statePtr->cntlStream, len, (Address)¬ify,
  174.                          &amountRead);
  175.     if (status != SUCCESS) {
  176.         Stat_PrintMsg(status, "Error reading control stream");
  177.         Proc_Exit(status);
  178.     } else if (amountRead != sizeof(notify)) {
  179.         Io_PrintStream(io_StdErr,
  180.         "Warning, short read (%d) on control stream\n", amountRead);
  181.         Io_Flush(io_StdErr);
  182.     }
  183.     streamID = notify.newStreamID;
  184.     if (streamID > statePtr->maxStreamID) {
  185.         statePtr->maxStreamID = streamID;
  186.     }
  187.     /*
  188.      * Tell the kernel where the request buffer is.
  189.      */
  190.     statePtr->request[client] = Mem_Alloc(REQUEST_BUF_SIZE);
  191.     setBuf.requestBufAddr = statePtr->request[client];
  192.     setBuf.requestBufSize = REQUEST_BUF_SIZE;
  193.     setBuf.readBufAddr = (Address)NULL;
  194.     setBuf.readBufSize = 0;
  195.     Fs_IOControl(streamID, IOC_PDEV_SET_BUF,
  196.             sizeof(Pdev_SetBufArgs), (Address)&setBuf, 0, NULL);
  197.     /*
  198.      * Set(Unset) write-behind by the client.
  199.      */
  200.     Fs_IOControl(streamID, IOC_PDEV_WRITE_BEHIND,
  201.             sizeof(int), (Address)&writeBehind, 0, NULL);
  202.     statePtr->clientStream[client] = streamID;
  203.     statePtr->clientState[client] = CLIENT_OPENED;
  204.     Io_PrintStream(io_StdErr, "Got client on stream %d\n",streamID);
  205.     Io_Flush(io_StdErr);
  206.     ServeRequest(statePtr->clientStream[client],
  207.              statePtr->request[client],
  208.              statePtr->opTable);
  209.     }
  210.     Io_Flush(io_StdErr);
  211.     /*
  212.      * Now that we know the largest stream ID used for a client stream
  213.      * we can allocate and initialize the select mask for the streams.
  214.      */
  215.     statePtr->selectMaskBytes = Bit_NumBytes(statePtr->maxStreamID);
  216.     statePtr->selectMask = (int *)Mem_Alloc(statePtr->selectMaskBytes);
  217.     Byte_Zero(statePtr->selectMaskBytes, (Address)statePtr->selectMask);
  218.     for (client=0 ; client < numClients ; client++) {
  219.     Bit_Set(statePtr->clientStream[client], statePtr->selectMask);
  220.     }
  221.     *dataPtr = (ClientData)statePtr;
  222. }
  223.  
  224. /*
  225.  *----------------------------------------------------------------------
  226.  *
  227.  * ServeRequest --
  228.  *
  229.  *    The top level service routine that reads client requests
  230.  *    and branches out to a handler for the request.  This takes
  231.  *    care of error conditions and allocating space for the
  232.  *    request and the reply parameters.
  233.  *
  234.  * Results:
  235.  *    None
  236.  *
  237.  * Side effects:
  238.  *    The server side of the pseudo-device protocol.
  239.  *
  240.  *----------------------------------------------------------------------
  241.  */
  242.  
  243. Pdev_Op
  244. ServeRequest(clientStreamID, myRequestBuf, opTable)
  245.     int clientStreamID;
  246.     Address myRequestBuf;
  247.     IntProc *opTable;
  248. {
  249.     register ReturnStatus status;
  250.     register Pdev_Request *requestPtr;
  251.     Pdev_Reply reply;
  252.     Pdev_BufPtrs bufPtrs;
  253.     register Pdev_Op operation;
  254.     int numBytes;
  255.     char replyBuf[REQUEST_BUF_SIZE];
  256.     register char *requestData;
  257.     register Address requestBuf;
  258.     register int i;
  259.  
  260.     /*
  261.      * Read the current pointers for the request buffer.
  262.      */
  263.  
  264.     status = Fs_Read(clientStreamID, sizeof(Pdev_BufPtrs),
  265.         (Address) &bufPtrs, &numBytes);
  266.     if ((status != SUCCESS) || (numBytes != sizeof(Pdev_BufPtrs))) {
  267.     Sys_Panic(SYS_FATAL, "%s; status \"%s\", count %d",
  268.         "ServeRequest had trouble reading request buffer pointers",
  269.         Stat_GetMsg(status), numBytes);
  270.     }
  271.     if (bufPtrs.magic != PDEV_BUF_PTR_MAGIC) {
  272.     Sys_Panic(SYS_FATAL, "%s: %d",
  273.         "ServeRequest got bad pointer magic number",
  274.         bufPtrs.magic);
  275.     }
  276.     /*
  277.      * While there are still requests in the buffer, service them.
  278.      */
  279.     requestBuf = bufPtrs.requestAddr;
  280.     while (bufPtrs.requestFirstByte < bufPtrs.requestLastByte) {
  281.     requestPtr = (Pdev_Request *)&requestBuf[bufPtrs.requestFirstByte];
  282.     if (requestPtr->magic != PDEV_REQUEST_MAGIC) {
  283.         Sys_Panic(SYS_FATAL, "ServeRequest, bad request magic # 0x%x\n",
  284.                 requestPtr->magic);
  285.     }
  286.     requestData = (Address)((int)requestPtr + sizeof(Pdev_Request));
  287.  
  288.     /*
  289.      * Switch out the to the handler for the pdev operation.
  290.      */
  291.     operation = requestPtr->operation;
  292.     status = (*opTable[(int)operation])(clientStreamID,
  293.         requestPtr, requestData, replyBuf, &reply.selectBits);
  294.  
  295.     if (delay > 0) {
  296.         for (i=delay<<1 ; i>0 ; i--) ;
  297.     }
  298.  
  299.     if (!writeBehind || operation != PDEV_WRITE) {
  300.         /*
  301.          * Set up the reply and tell the kernel about it.
  302.          */
  303.     
  304.         reply.magic = PDEV_REPLY_MAGIC;
  305.         reply.status = SUCCESS;
  306.         reply.replySize = requestPtr->replySize;
  307.         reply.replyBuf = replyBuf;
  308.         status = Fs_IOControl(clientStreamID, IOC_PDEV_REPLY,
  309.                     sizeof(Pdev_Reply),
  310.                     (Address) &reply, 0, NULL);
  311.         if (status != SUCCESS) {
  312.         Sys_Panic(SYS_FATAL, "%s; status \"%s\"",
  313.             "ServeRequest couldn't send reply",
  314.             Stat_GetMsg(status));
  315.         }
  316.     }
  317.     bufPtrs.requestFirstByte += requestPtr->messageSize;
  318.     }
  319.     Fs_IOControl(clientStreamID, IOC_PDEV_SET_PTRS,
  320.             sizeof(Pdev_BufPtrs), (Address)&bufPtrs,
  321.             0, NULL);
  322.     return(operation);
  323. }
  324.  
  325. /*
  326.  *----------------------------------------------------------------------
  327.  *
  328.  * Serve --
  329.  *
  330.  *    Listen for requests from client's, returning after all clients
  331.  *    have closed their streams.
  332.  *
  333.  * Results:
  334.  *    None
  335.  *
  336.  * Side effects:
  337.  *    Handle all requests by clients.
  338.  *
  339.  *----------------------------------------------------------------------
  340.  */
  341.  
  342. void
  343. Serve(data)
  344.     ClientData data;
  345. {
  346.     ServerState *statePtr;
  347.     int client;
  348.     ReturnStatus status;
  349.     int *selectMask;
  350.     int numFinishedClients;
  351.     int numReady;
  352.     Pdev_Op operation;
  353.  
  354.     statePtr = (ServerState *)data;
  355.     selectMask = (int *)Mem_Alloc(statePtr->selectMaskBytes);
  356.     numFinishedClients = 0;
  357.     do {
  358.     Byte_Copy(statePtr->selectMaskBytes, (Address)statePtr->selectMask,
  359.                          (Address)selectMask);
  360.     status = Fs_Select(statePtr->numClients, NULL, selectMask,
  361.                 NULL, NULL, &numReady);
  362.     for (client=0 ; client < statePtr->numClients ; client++) {
  363.         /*
  364.          * Look for the each client's bit in the select mask and read the
  365.          * corresponding stream for its initial request.
  366.          */
  367.         if (Bit_IsSet(statePtr->clientStream[client], selectMask)) {
  368.         /*
  369.          * Handle the client's request.  If it's a close
  370.          * then clear the client's bit from the select mask so
  371.          * don't bother checking it again.
  372.          */
  373.         operation = ServeRequest(statePtr->clientStream[client],
  374.                  statePtr->request[client],
  375.                  statePtr->opTable);
  376.         if (operation == PDEV_CLOSE ||
  377.             operation == (Pdev_Op)-1) {
  378.             Io_PrintStream(io_StdErr, "Client %d %s...", client,
  379.             (operation == PDEV_CLOSE) ? "closed" : "error" );
  380.             Io_Flush(io_StdErr);
  381.             numFinishedClients++;
  382.             statePtr->clientState[client] |= CLIENT_FINISHED;
  383.             Bit_Clear(statePtr->clientStream[client],
  384.                 statePtr->selectMask);
  385.         } else if ((operation == PDEV_READ) && select) {
  386.             /*
  387.              * If the select flag is set, then we must
  388.              * remember to simulate input for the client
  389.              * every so often.  This tests regular blocking
  390.              * reads, and selects by the client.  This goes
  391.              * with the fact that we only return FS_WRITABLE
  392.              * if the select flag is set.
  393.              */
  394.             Time time;
  395.             int selectBits;
  396.             time.seconds = 0;
  397.             time.microseconds = 400;
  398.             Sync_WaitTime(time);
  399.             Io_Print("Waking up client\n"); Io_Flush(io_StdOut);
  400.             selectBits = FS_READABLE|FS_WRITABLE;
  401.             Fs_IOControl(statePtr->clientStream[client],
  402.                 IOC_PDEV_READY, sizeof(int), &selectBits,
  403.                 0, NULL);
  404.         }
  405.         }
  406.     }
  407.     } while (numFinishedClients < statePtr->numClients);
  408.     Io_PrintStream(io_StdErr, "\n");
  409.     Io_Flush(io_StdErr);
  410. }
  411.  
  412. /*
  413.  *----------------------------------------------------------------------
  414.  *
  415.  * ServeOne --
  416.  *
  417.  *    A service loop for one client.  More bare-bones test used
  418.  *    for timing.
  419.  *
  420.  * Results:
  421.  *    None
  422.  *
  423.  * Side effects:
  424.  *    Handle all requests one client.
  425.  *
  426.  *----------------------------------------------------------------------
  427.  */
  428.  
  429. void
  430. ServeOne(data)
  431.     ClientData data;
  432. {
  433.     register ServerState *statePtr;
  434.     register int client;
  435.     ReturnStatus status;
  436.     int *selectMask;
  437.     int numFinishedClients;
  438.     int numReady;
  439.     Pdev_Op operation;
  440.  
  441.     statePtr = (ServerState *)data;
  442.     client = 0;
  443.     do {
  444.     operation = ServeRequest(statePtr->clientStream[client],
  445.              statePtr->request[client],
  446.              statePtr->opTable);
  447.     if (operation == PDEV_CLOSE ||
  448.         operation == (Pdev_Op)-1) {
  449.         Io_PrintStream(io_StdErr, "Client %d %s...", client,
  450.         (operation == PDEV_CLOSE) ? "closed" : "error" );
  451.         Io_Flush(io_StdErr);
  452.         break;
  453.     } else if ((operation == PDEV_READ) && select) {
  454.         /*
  455.          * If the select flag is set, then we must
  456.          * remember to simulate input for the client
  457.          * every so often.  This tests regular blocking
  458.          * reads, and selects by the client.  This goes
  459.          * with the fact that we only return FS_WRITABLE
  460.          * if the select flag is set.
  461.          */
  462.         Time time;
  463.         int selectBits;
  464.         time.seconds = 0;
  465.         time.microseconds = 400;
  466.         Sync_WaitTime(time);
  467.         Io_Print("Waking up client\n"); Io_Flush(io_StdOut);
  468.         selectBits = FS_READABLE|FS_WRITABLE;
  469.         Fs_IOControl(statePtr->clientStream[client],
  470.             IOC_PDEV_READY, sizeof(int), &selectBits,
  471.             0, NULL);
  472.     }
  473.     } while (1);
  474.     Io_PrintStream(io_StdErr, "\n");
  475.     Io_Flush(io_StdErr);
  476. }
  477.  
  478. /*
  479.  *----------------------------------------------------------------------
  480.  *
  481.  * NullProc --
  482.  *
  483.  *    The do-nothing service procedure.
  484.  *
  485.  * Results:
  486.  *    SUCCESS
  487.  *
  488.  * Side effects:
  489.  *    Zeroes out the reply buffer.
  490.  *
  491.  *----------------------------------------------------------------------
  492.  */
  493.  
  494. ReturnStatus
  495. NullProc(streamID, requestPtr, requestBuf, replyBuf, selectBitsPtr)
  496.     int streamID;
  497.     Pdev_Request *requestPtr;
  498.     Address requestBuf;
  499.     Address replyBuf;
  500.     int *selectBitsPtr;
  501. {
  502.     if (requestPtr->replySize > 0) {
  503.     Byte_Zero(requestPtr->replySize, replyBuf);
  504.     }
  505.     return(SUCCESS);
  506. }
  507.  
  508. /*
  509.  *----------------------------------------------------------------------
  510.  *
  511.  * ServeOpen --
  512.  *
  513.  *    React to an Open request.  This initializes the
  514.  *    select state to both readable and writable.
  515.  *
  516.  * Results:
  517.  *    SUCCESS
  518.  *
  519.  * Side effects:
  520.  *    Print statement.
  521.  *
  522.  *----------------------------------------------------------------------
  523.  */
  524.  
  525. ReturnStatus
  526. ServeOpen(streamID, requestPtr, requestBuf, replyBuf, selectBitsPtr)
  527.     int streamID;
  528.     Pdev_Request *requestPtr;
  529.     Address requestBuf;
  530.     Address replyBuf;
  531.     int *selectBitsPtr;
  532. {
  533.     Io_PrintStream(io_StdErr, "Open request, streamID %d\n", streamID);
  534.     Io_Flush(io_StdErr);
  535.     *selectBitsPtr = FS_READABLE | FS_WRITABLE;
  536.     return(SUCCESS);
  537. }
  538.  
  539. /*
  540.  *----------------------------------------------------------------------
  541.  *
  542.  * ServeRead --
  543.  *
  544.  *    Return data for a read request.  This plays a game with the
  545.  *    client if the select flag (-s) is set:  every other read
  546.  *    gets blocked in order to test IOC_PDEV_READY.
  547.  *
  548.  * Results:
  549.  *    SUCCESS
  550.  *
  551.  * Side effects:
  552.  *    Zeroes out the reply buffer.
  553.  *
  554.  *----------------------------------------------------------------------
  555.  */
  556.  
  557. ReturnStatus
  558. ServeRead(streamID, requestPtr, requestBuf, replyBuf, selectBitsPtr)
  559.     int streamID;
  560.     Pdev_Request *requestPtr;
  561.     Address requestBuf;
  562.     Address replyBuf;
  563.     int *selectBitsPtr;
  564. {
  565.     if (select && !blocked) {
  566.     blocked = TRUE;
  567.     *selectBitsPtr = FS_WRITABLE;
  568.     return(FS_WOULD_BLOCK);
  569.     } else {
  570.     if (requestPtr->replySize > 0) {
  571.         Byte_Zero(requestPtr->replySize, replyBuf);
  572.         replyBuf[0] = 'z';
  573.     }
  574.     blocked = FALSE;
  575.     if (! select) {
  576.         *selectBitsPtr = FS_WRITABLE | FS_READABLE;
  577.     } else {
  578.         *selectBitsPtr = FS_WRITABLE;
  579.     }
  580.     return(SUCCESS);
  581.     }
  582. }
  583.  
  584. /*
  585.  *----------------------------------------------------------------------
  586.  *
  587.  * ServeWrite --
  588.  *
  589.  *    Handle a write request.
  590.  *
  591.  * Results:
  592.  *    SUCCESS
  593.  *
  594.  * Side effects:
  595.  *    Sets up the select bits.
  596.  *
  597.  *----------------------------------------------------------------------
  598.  */
  599.  
  600. ReturnStatus
  601. ServeWrite(streamID, requestPtr, requestBuf, replyBuf, selectBitsPtr)
  602.     int streamID;
  603.     Pdev_Request *requestPtr;
  604.     Address requestBuf;
  605.     Address replyBuf;
  606.     int *selectBitsPtr;
  607. {
  608.     *selectBitsPtr = FS_WRITABLE;
  609.     if (! select) {
  610.     *selectBitsPtr |= FS_READABLE;
  611.     }
  612.     requestPtr->replySize = 0;
  613.     return(SUCCESS);
  614. }
  615.  
  616. /*
  617.  *----------------------------------------------------------------------
  618.  *
  619.  * ServeIOControl --
  620.  *
  621.  *    Handle an IOControl.  This acts like an echo now.
  622.  *
  623.  * Results:
  624.  *    SUCCESS
  625.  *
  626.  * Side effects:
  627.  *    Copies the request buffer to the reply buffer.
  628.  *
  629.  *----------------------------------------------------------------------
  630.  */
  631.  
  632. ReturnStatus
  633. ServeIOControl(streamID, requestPtr, requestBuf, replyBuf, selectBitsPtr)
  634.     int streamID;
  635.     Pdev_Request *requestPtr;
  636.     Address requestBuf;
  637.     Address replyBuf;
  638.     int *selectBitsPtr;
  639. {
  640. #ifdef notdef
  641.     if (requestPtr->replySize <= requestPtr->requestSize) {
  642.     Byte_Copy(requestPtr->replySize, requestBuf, replyBuf);
  643.     } else {
  644.     Byte_Copy(requestPtr->requestSize, requestBuf, replyBuf);
  645.     Byte_Zero(requestPtr->replySize - requestPtr->requestSize,
  646.             replyBuf[requestPtr->requestSize]);
  647.     }
  648. #endif
  649.     switch (requestPtr->param.ioctl.command) {
  650.     case IOC_PDEV_SET_BUF: {
  651.         /*
  652.          * Let the client trigger our test of the mid-flight
  653.          * setbuf call.
  654.          */
  655.         Pdev_SetBufArgs setBuf;
  656.  
  657.         setBuf.requestBufAddr = Mem_Alloc(REQUEST_BUF_SIZE);
  658.         setBuf.requestBufSize = REQUEST_BUF_SIZE;
  659.         setBuf.readBufAddr = (Address)NULL;
  660.         setBuf.readBufSize = 0;
  661.         Fs_IOControl(streamID, IOC_PDEV_SET_BUF,
  662.                 sizeof(Pdev_SetBufArgs), (Address)&setBuf, 0, NULL);
  663.     
  664.     }
  665.     }
  666.     *selectBitsPtr = FS_WRITABLE;
  667.     if (! select) {
  668.     *selectBitsPtr |= FS_READABLE;
  669.     }
  670.     return(SUCCESS);
  671. }
  672. @
  673.  
  674.  
  675. 1.2
  676. log
  677. @Increased buffer size, added delay
  678. @
  679. text
  680. @d13 1
  681. a13 1
  682. static char rcsid[] = "$Header: server.c,v 1.1 88/04/16 12:28:31 brent Exp $ SPRITE (Berkeley)";
  683. d45 1
  684. a45 1
  685. #define REQUEST_BUF_SIZE    (2048 + sizeof(Pdev_NewRequest))
  686. a54 1
  687. Pdev_WaitInfo waitInfo;
  688. d210 1
  689. a210 1
  690. ServeRequest(clientStreamID, requestBuf, opTable)
  691. d212 1
  692. a212 1
  693.     Address requestBuf;
  694. d216 2
  695. a217 2
  696.     register Pdev_NewRequest *requestPtr;
  697.     Pdev_NewReply reply;
  698. d247 1
  699. a247 1
  700.     requestPtr = (Pdev_NewRequest *)&requestBuf[bufPtrs.requestFirstByte];
  701. d252 1
  702. a252 1
  703.     requestData = (Address)((int)requestPtr + sizeof(Pdev_NewRequest));
  704. d275 1
  705. a275 1
  706.                     sizeof(Pdev_NewReply),
  707. d463 1
  708. a463 1
  709.     Pdev_NewRequest *requestPtr;
  710. d494 1
  711. a494 1
  712.     Pdev_NewRequest *requestPtr;
  713. d499 1
  714. a499 2
  715.     Io_PrintStream(io_StdErr, "Open request, streamID %d, clientID %d\n",
  716.         streamID, requestPtr->param.open.clientID);
  717. d526 1
  718. a526 1
  719.     Pdev_NewRequest *requestPtr;
  720. d569 1
  721. a569 1
  722.     Pdev_NewRequest *requestPtr;
  723. d601 1
  724. a601 1
  725.     Pdev_NewRequest *requestPtr;
  726. @
  727.  
  728.  
  729. 1.1
  730. log
  731. @Initial revision
  732. @
  733. text
  734. @d13 1
  735. a13 1
  736. static char rcsid[] = "$Header: server.c,v 1.3 87/06/12 15:03:41 brent Exp $ SPRITE (Berkeley)";
  737. d29 1
  738. d45 1
  739. a45 1
  740. #define REQUEST_BUF_SIZE    2048
  741. d225 1
  742. d261 4
  743. @
  744.